package com.flower.salary.controller;

import com.flower.salary.common.utils.R;
import com.flower.salary.domain.entity.SysMenu;
import com.flower.salary.domain.vo.Ztree;
import com.flower.salary.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 菜单权限表 前端控制器
 * </p>
 *
 * @author baomidou
 * @since 2023-12-22
 */
@RestController
@RequestMapping("/salary/sysMenu")
public class SysMenuController {





    @Autowired
    private SysMenuService sysMenuService;



    @GetMapping("/routes")
    public R getRoutes(String token){

        List<Ztree> routes = sysMenuService.getRoutes(token);



        return R.ok(routes);
    }



    @GetMapping("/role")
    public R getRole(String token){


        String role = sysMenuService.getRole(token);

        return R.ok(role);
    }




    @GetMapping("/")
    public String json(){

        String json = "{\n" +
                "  \"job\": {\n" +
                "    \"content\": [\n" +
                "      {\n" +
                "        \"reader\": {\n" +
                "          \"parameter\": {\n" +
                "            \"column\": [\n" +
                "              {\n" +
                "                \"type\": \"2\",\n" +
                "                \"value\": \"2\"\n" +
                "              }\n" +
                "            ],\n" +
                "            \"sliceRecordCount\": \"2\"\n" +
                "          },\n" +
                "          \"name\": \"2\"\n" +
                "        },\n" +
                "        \"writer\": {\n" +
                "          \"parameter\": {\n" +
                "            \"print\": \"2\",\n" +
                "            \"encoding\": \"2\"\n" +
                "          },\n" +
                "          \"name\": \"2\"\n" +
                "        }\n" +
                "      }\n" +
                "    ],\n" +
                "    \"setting\": {\n" +
                "      \"errorLimit\": {\n" +
                "        \"record\": \"2\",\n" +
                "        \"percentage\": \"2\"\n" +
                "      },\n" +
                "      \"speed\": {\n" +
                "        \"channel\": \"2\"\n" +
                "      }\n" +
                "    }\n" +
                "  }\n" +
                "}";
        return json;
    }

}
